/*
 * JVM_CP_Table.h
 *
 *  Created on: 02.01.2011
 *      Author: Tavin
 */



#include <stdint.h>

#include "JVM_CP.h"

#include "JVM_CP_Class.h"
#include "JVM_CP_Double.h"
#include "JVM_CP_Field.h"
#include "JVM_CP_Float.h"
#include "JVM_CP_Integer.h"
#include "JVM_CP_Long.h"
#include "JVM_CP_Method.h"
#include "JVM_CP_Name.h"
#include "JVM_CP_String.h"
#include "JVM_CP_Utf8.h"


#ifndef JVM_CP_TABLE_H_
#define JVM_CP_TABLE_H_

/**
 * Constant Pool Table
 */
typedef struct{
	uint16_t size;
	uint16_t dummy;
	JVM_CP_t * constants[];

} JVM_CP_Table_t;




uint16_t static inline  JVM_CP_Table_size(JVM_CP_Table_t * myTable)
{
	return(myTable->size);
}


/****************************************************************************************/
/*																						*/
/*	Function : JVM_Class_getCpType							Author : OG					*/
/*																						*/
/*	Description : 								   										*/
/*																						*/
/*	Version : 1.0					Date :2011.1.3			Status : Working   			*/
/*																						*/
/****************************************************************************************/

uint16_t static inline JVM_CPTable_getCpType(JVM_CP_Table_t *myCpTable,uint16_t index)
{
	return(myCpTable->constants[index-1]->type);
}




JVM_CP_Method_t *JVM_CPTable_getMethodInfo(JVM_CP_Table_t *myCpTable, uint16_t index);
JVM_CP_Name_t *JVM_CPTable_getNameInfo(JVM_CP_Table_t *myCpTable, uint16_t index);
JVM_CP_UTF8_t *JVM_CPTable_getUtf8Info(JVM_CP_Table_t *myCpTable, uint16_t index);
JVM_CP_Field_t *JVM_CPTable_getFieldInfo(JVM_CP_Table_t *myCpTable, uint16_t index);
JVM_CP_Integer_t *JVM_CPTable_getIntegerInfo(JVM_CP_Table_t *myCpTable, uint16_t index);
JVM_CP_Long_t *JVM_CPTable_getLongInfo(JVM_CP_Table_t *myCpTable, uint16_t index);
JVM_CP_Float_t *JVM_CPTable_getFloatInfo(JVM_CP_Table_t *myCpTable, uint16_t index);
JVM_CP_Double_t *JVM_CPTable_getDoubleInfo(JVM_CP_Table_t *myCpTable, uint16_t index);
JVM_CP_String_t *JVM_CPTable_getStringInfo(JVM_CP_Table_t *myCpTable, uint16_t index);
JVM_CP_Class_t *JVM_CPTable_getClassInfo(JVM_CP_Table_t *myCpTable, uint16_t index);
#endif /* JVM_CP_TABLE_H_ */
